/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.eps.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Diana
 */
@Entity
@Table(name = "SubAlmacen")
@NamedQueries({
    @NamedQuery(name = "SubAlmacen.findAll", query = "SELECT s FROM SubAlmacen s"),
    @NamedQuery(name = "SubAlmacen.findByIdSubAlmacen", query = "SELECT s FROM SubAlmacen s WHERE s.idSubAlmacen = :idSubAlmacen"),
    @NamedQuery(name = "SubAlmacen.findByDescripcion", query = "SELECT s FROM SubAlmacen s WHERE s.descripcion = :descripcion"),
    @NamedQuery(name = "SubAlmacen.findByIdDireccion", query = "SELECT s FROM SubAlmacen s WHERE s.idDireccion = :idDireccion"),
    @NamedQuery(name = "SubAlmacen.findByTelefono", query = "SELECT s FROM SubAlmacen s WHERE s.telefono = :telefono"),
    @NamedQuery(name = "SubAlmacen.findByRepresentante", query = "SELECT s FROM SubAlmacen s WHERE s.representante = :representante")})
public class SubAlmacen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_SubAlmacen", length = 2)
    private String idSubAlmacen;
    @Column(name = "descripcion", length = 50)
    private String descripcion;
    @Column(name = "id_direccion")
    private BigInteger idDireccion;
    @Column(name = "telefono", length = 20)
    private String telefono;
    @Column(name = "representante", length = 50)
    private String representante;
    @JoinColumn(name = "idAlmacen", referencedColumnName = "id_almacen")
    @ManyToOne
    private Almacen idAlmacen;
    @OneToMany(mappedBy = "idUbicacion")
    private List<Orden> ordenList;

    public SubAlmacen() {
    }

    public SubAlmacen(String idSubAlmacen) {
        this.idSubAlmacen = idSubAlmacen;
    }

  

    public String getIdSubAlmacen() {
        return idSubAlmacen;
    }

    public void setIdSubAlmacen(String idSubAlmacen) {
        this.idSubAlmacen = idSubAlmacen;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public BigInteger getIdDireccion() {
        return idDireccion;
    }

    public void setIdDireccion(BigInteger idDireccion) {
        this.idDireccion = idDireccion;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getRepresentante() {
        return representante;
    }

    public void setRepresentante(String representante) {
        this.representante = representante;
    }

    public Almacen getIdAlmacen() {
        return idAlmacen;
    }

    public void setIdAlmacen(Almacen idAlmacen) {
        this.idAlmacen = idAlmacen;
    }

    public List<Orden> getOrdenList() {
        return ordenList;
    }

    public void setOrdenList(List<Orden> ordenList) {
        this.ordenList = ordenList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSubAlmacen != null ? idSubAlmacen.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {

        if (!(object instanceof SubAlmacen)) {
            return false;
        }
        SubAlmacen other = (SubAlmacen) object;
        if ((this.idSubAlmacen == null && other.idSubAlmacen != null) || (this.idSubAlmacen != null && !this.idSubAlmacen.equals(other.idSubAlmacen))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "suministros.ejb30.entity.SubAlmacen[idSubAlmacen=" + idSubAlmacen + "]";
    }

}
